<?php
/**
 * Created by PhpStorm.
 * User: rui
 * Date: 2018/8/10
 * Time: 下午9:17
 */

namespace app\admin\controller;


use app\common\controller\Base;
use app\common\model\AccountBook;
use think\db\Query;

class Account extends Base
{
    public function index()
    {
        return $this->fetch();
    }

    public function getList()
    {
        $id = input('id');
        $bid = input('bid');
        $name = input('name');
        $arr = [
            'id' => $id
            ,'bid'=>$bid
            ,'name'=>$name
        ];
        $where = array_filter($arr);
        $accs = AccountBook::all(function (Query $query) use ($where){
            $query->where($where)->limit(input('limit'))->page(input('page'));
        },'getBankList');
        if (!$accs){
            return $this->errorInfo('暂无数据');
        }
        $data['code']=0;
        $data['count']=(new AccountBook())->count();
        $data['msg']='成功';
        $data['data'] = $accs;
        return $data;
    }
}